package Spil;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class IntroGUI extends JFrame implements ActionListener {

	private JPanel panel = new JPanel();
	private JLabel l1 = new JLabel(Txt.IntroGUI);
	private JButton b1 = new JButton ("2");
	private JButton b2 = new JButton ("3");
	private JButton b3 = new JButton ("4");
	private JButton b4 = new JButton ("5");
	private JButton b5 = new JButton ("6");
	private int number;
	private boolean wait;

	public IntroGUI() {

		this.wait = false;

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(175, 205);

		add(panel);

		panel.setBackground(new Color(47,175,13));

		l1.setFont(new Font("Arial", Font.PLAIN,18));

		b1.setFont(new Font("Old English Text MT", Font.PLAIN,22));
		b2.setFont(new Font("Old English Text MT", Font.PLAIN,22));
		b3.setFont(new Font("Old English Text MT", Font.PLAIN,22));
		b4.setFont(new Font("Old English Text MT", Font.PLAIN,22));
		b5.setFont(new Font("Old English Text MT", Font.PLAIN,22));

		b1.setPreferredSize(new Dimension(50, 40));
		b2.setPreferredSize(new Dimension(50, 40));
		b3.setPreferredSize(new Dimension(50, 40));
		b4.setPreferredSize(new Dimension(50, 40));
		b5.setPreferredSize(new Dimension(50, 40));

		panel.add (l1);
		panel.add (b1);
		panel.add (b2);
		panel.add (b3);
		panel.add (b4);
		panel.add (b5);

		b1.addActionListener(this);
		b2.addActionListener(this);
		b3.addActionListener(this);
		b4.addActionListener(this);
		b5.addActionListener(this);
	}

	public void actionPerformed(ActionEvent evt) {
		if (evt.getSource() == b1) {
			this.number = 2;
			setVisible(false);
			this.wait = true;
		}
		else if (evt.getSource() == b2) {
			this.number = 3;
			setVisible(false);
			this.wait = true;
		}
		else if (evt.getSource() == b3) {
			this.number = 4;
			setVisible(false);
			this.wait = true;
		}
		else if (evt.getSource() == b4) {
			this.number = 5;
			setVisible(false);
			this.wait = true;
		}
		else if (evt.getSource() == b5) {
			this.number = 6;
			setVisible(false);
			this.wait = true;
		}
	}

	public int getNumber() {
		return this.number;
	}

	public boolean getWait() {
		return this.wait;
	}


}
